import java.util.*;

public class Main {
    private int n;
    private String str;

    private boolean check(String s) {
        try {
            int integer = Integer.parseInt(s);
            return integer >= 0 && integer < 256;
        } catch (NumberFormatException ex) {
            return false;
        }
    }

    private void dfs(int i, int lastK, String[] dat) {
        if (i == n) {
            String cstr = str.substring(lastK);
            if (check(cstr)) {
                for (String s : dat) {
                    System.out.print(s + ".");
                }
                System.out.println(cstr);
            }
            return;
        }
        for (int j = lastK + 1; j < str.length(); j++) {
            if (j - lastK > 3) break;   //剪枝
            String cstr = str.substring(lastK, j);
            if (!check(cstr)) continue;
            dat[i] = cstr;
            dfs(i + 1, j, dat);
        }
    }

    public Main(int n, String str) {
        this.n = n;
        this.str = str;
    }

    public void solve() {
        this.dfs(0, 0, new String[n]);
    }

    public static void main(String[] args) {
        Main main = new Main(3, "1921681255");
        main.solve();
    }
}